#!/bin/bash
time=$(date "+%Y%m%d")

sql="insert into test1.user_info select id,click_time from  ( select id,click_time,row_number() over(partition by id order by click_time) as rk from test1.user_clicks where dt = '$time' )tmp where rk = 1"
echo $sql > analysis.sql